home *** CD-ROM | disk | FTP | other *** search
/ C/C++ Users Group Library 1996 July / C-C++ Users Group Library July 1996.iso / listings / v_12_10 / saks / clear.cpp < prev    next >
Text File  |  1994-08-08  |  322b  |  17 lines

  1. Listing 3 - A member function, clear, that discards all the elements in 
  2. a queue that has elements of type T.
  3.  
  4. // destroy all in the elements in a queue
  5.  
  6. void Tq::clear()
  7.     {
  8.     cell *p;
  9.     while (first != 0)
  10.         {
  11.         p = first;
  12.         first = first->next;
  13.         delete p;
  14.         }
  15.     }
  16.  
  17.